package com.itheima.homework;

import java.util.Scanner;

public class Test7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个小数:");
        double a = sc.nextDouble();
        System.out.println("四舍五入为: " + value(a));
    }

    public static int value(double a) {
        int x = (int) a;
        double y = a - x;
        int z = y > 0.5 ? x + 1 : x;
        return z;
    }

}
